<template>
  <div>
    <div class="index-module">
      <div class="flex-vertical">
        <h2>精选文章</h2>
        <div class="more">更多</div>
      </div>
      <div class="artical">
        <router-link class="item" :to="'/artical?id=' + item.id" v-for="item in dataList" :key="item.id">
          <img
            :src="item.coverImage"
            alt=""
            onerror="this.src='https://med-video.cdn.bcebos.com/actplat/59fa02bdd9c1.jpg'"
          />
          <div class="title"><p>{{item.title}}</p></div>
        </router-link>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      dataList:[]
    };
  },
  created(){
    this.getDataList()
  },
  methods:{
    getDataList(){
      this.HttpService.getMostPV().then(res =>{
        console.log(res)
        let data = res.data;
        data.map(item => {
          if(item.status == '1'){
            this.dataList.push(item)
          }
        })
      })
    }
  }
};
</script>

<style lang='less' scoped>
.flex-vertical {
  position: relative;
  .more {
    position: absolute;
    right: 20px;
  }
}
.artical {
  display: flex;
  flex-wrap: wrap;
  flex-wrap: nowrap;
  overflow-x: scroll;
  .item {
    margin-top: 15px;
    margin-right: 5px;
    position: relative;
    img {
      width: 280px;
      height: 163px;
      border-radius: 15px;
    }
    .title {
      position: absolute;
      background-color: rgba(0,0,0,0.5);
      filter:Alpha(opacity=50);
      *zoom:1;
      bottom: 5px;
      line-height: 40px;
      width: 100%;
      border-radius: 0px 0px 15px 15px;
      p {
        bottom: 10px;
        left: 5px;
        color: #fff;
        margin-left: 15px;
      }
    }
  }
}
/* 定义滚动条样式 */
/*定义滚动条高宽及背景
 高宽分别对应横竖滚动条的尺寸*/
::-webkit-scrollbar
{
    width:16px;
    height:10px;
    background-color:#F5F5F5;
}
/*定义滚动条轨道
 内阴影+圆角*/
::-webkit-scrollbar-track
{
    -webkit-box-shadow:inset 0 0 0px rgba(0,0,0,0.1);
    border-radius:5px;
    background-color:#f6f6f6;
}
/*定义滑块
 内阴影+圆角*/
::-webkit-scrollbar-thumb
{
    border-radius:5px;
    -webkit-box-shadow:inset 0 0 0px rgba(0,0,0,.1);
    background-color:#ccc;
}
</style>
